Hi Tom
Thanks for that response. Another simple question. Is there a way of triggering a command like "ClearBit154" as soon as Feed Hold or Stop is pressed in KmotionCNC?
best
Edward
--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Edward,
> Â
> In this case it would probably be better to have the GCode Set a Virtual IO bit that an already running C program could detect to start the solenoid sequence. In KMotionCNC there is a way to insert buffered IO commands into the motion buffer that will happen in exact sync with the motion. So for example in GCode:
> Â
> Â
> (BUF,SetBitBuf48);
> G1 Z-1 F10
> (BUF,ClearBitBuf48)
> Â
> Â
> Then in KFLOP C code
> Â
> for(;;) // loop forever
> {
> Â Â Â Â while (!ReadBit(48)) ;Â // wait for signal
> Â
> Â Â Â Â SetBit(XX);Â // solenoid on
> Â Â Â Delay_sec(0.1);
> Â Â Â Â ClearBit(XX); //solenoid off
> Â
> Â Â Â Â while (!ReadBit(48));Â // wait for signal to reset
> }
> Â
> Â
> The C code loop might be added to the end of your Init.c program
>
> Regards
> TK
> Â
> Â
>
> ________________________________
> From: Edward Forwood <edward@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, March 7, 2012 9:12 AM
> Subject: RE: [DynoMotion] Simultaneous commands
>
>
>
> Â
>
> Hi Tom
> Â
> Thanks, but I am using KmotionCNC (apologies, I should have said so). I am not quite clear how to implement in Kmotioncnc. Presumably it’s a bit easier? The machine is designed to drill at 4 holes plus per second so timing is important! Just to confirm the solenoid sequence needs to start at the same time as the z axis starts to move.
> Â
> Best regards
> Â
> Edward
> Â
> From:DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes
> Sent: 07 March 2012 16:29
> To: DynoMotion@yahoogroups.com
> Subject: Re: [DynoMotion] Simultaneous commands
> Â
> Â
> Hi Edward,
> Â
> I assume you wish to use Mach3?
> Â
> I think you may need to use a Virtual IO bit to force Mach3 to wait until your sequence is complete.
> Â
> It sounds like an approach as follows may work:
> Â
> Configure Mach3 Ports&Pins Input #1 as Port1 Bit48
> Â
> Â
> Define a VBÂ Mcode M180
> Â Â Â Â Â NotifyPlugins(10080)Â Â Â 'this will tell KFLOP to clear a virtual bit #48 and start Solenoid Sequence
> Â
> Define a VB MCode M181
> Â Â Â Â Â while(IsActive(1))
> Â Â Â Â Â Â Â Â Â Sleep(10)
> Â Â Â Â Â end while
> Â Â Â
> Â
> KFLOP Notify program:
> ------------------------------
> Â
> if (msg==10080)
> {
> Â Â Â Â SetBit(48);Â // signal we are busy
> Â Â Â Â
> Â Â Â SetBit(XXX);Â // solenoid on
> Â Â Â Â Delay_sec(5);
> Â Â Â Â ClearBit(XXX); // solenoid off
> Â Â Â
> Â Â Â ClearBit(48); // signal we are done
> }
> Â
> In GCode
> ------------
> M180
> G1Z1F10
> M181
> Â
> Â
> Let me know how much of this makes sense
> Â
> Regards
> TK
> Â
> Â
> Â
> Â
> Â
> Â
> From:dotma99 <edward@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, March 7, 2012 5:06 AM
> Subject: [DynoMotion] Simultaneous commands
> Â
> Â
> Hi Tom
>
> I have just bought a kflop and kanalog and am very impressed so far.
>
> A question. I have built a machine for a specialised drilling process and I want to be able to move my Z axis down, while simultaneously starting a program which starts a sequence of firing two solenoids. Control needs to returned to the G code program on completion of the solenoid program, not the Z move.
>
> I have looked at the NotifyTapMach3 v2.c example which has some clues, but I am not knowledgeable enough to extrapolate that to my application.
>
> Could you give me some help with this?
>
> thanks in advance
>
> Edward
> Â
>